package com.kk.decorator;

public class Decorator extends AbstractDrink {

    private final AbstractDrink drink;

    /**
     * 聚合关系
     *
     * @param drink
     */
    public Decorator(AbstractDrink drink) {
        this.drink = drink;
    }

    @Override
    public Float cost() {
        return super.getPrice() + drink.cost();
    }

    @Override
    public String getDes() {
        //drink.getDes   加料之前嵌套商品的描述
        return super.getDes() + " " + super.getPrice() + " && " + drink.getDes();
    }
}
